﻿Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.Collections
Imports System.Collections.Generic

Imports System.Diagnostics

<CLSCompliant(True)> _
Public Interface ISimpleReadWriteLockerEventTracker
	ReadOnly Property ReadLockCount  As Integer
	ReadOnly Property WriteLockCount As Integer

  Event LockedForReading()
	Event UnlockedForReading()

	Event LockedForWriting()
	Event UnlockedForWriting()
End Interface

<CLSCompliant(True)> _
Public Interface ISimpleReadWriteLocker
	Inherits IDisposable

	ReadOnly Property IsThreadSafe As Boolean

	ReadOnly Property IsReading As Boolean
	ReadOnly Property IsWriting As Boolean

	Function GetReadLock()     As IDisposable
	Function GetWriteLock()    As IDisposable
	Function TryGetReadLock()  As IDisposable
	Function TryGetWriteLock() As IDisposable
End Interface

<CLSCompliant(True)> _
Public Interface IComplexReadWriteLocker
	Inherits ISimpleReadWriteLockerEventTracker, _
					 ISimpleReadWriteLocker

	Sub LockForReading()
	Sub UnlockForReading()

	Sub LockForWriting()
	Sub UnlockForWriting()

	Sub TryLockForWriting()
	Sub TryUnlockForWriting()

	Sub TryLockForReading()
	Sub TryUnlockForReading()
End Interface

<CLSCompliant(True)> _
Public Interface IReadWriteLocker
	Inherits IComplexReadWriteLocker

  Function IsCurrentThreadLockedForReading() As Boolean
	Function IsCurrentThreadLockedForWriting() As Boolean

	Function GetSyncLock() As IDisposable
  Function GetLock()     As IDisposable
End Interface
